package main

import (
	"fmt"
	"practice/m/models"
	"reflect"
)

// esayjson使用
func main() {
	m := models.User{"xiaobai", 6}
	json, error := m.MarshalJSON()
	if error != nil {
		fmt.Println(error)
	} else {
		fmt.Println(string(json))
	}

	var json1 = `{"name":"小白",age:6}`
	fmt.Println(reflect.TypeOf(json1), []byte(json1))
	ss := models.User{}
	ss.UnmarshalJSON([]byte(json1))
	fmt.Println(ss)
}
